/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package technotheist.data.wrap;

import technotheist.data.BBuffer;

/**
 *
 * @author Mitch
 */
public class BSubBuffer<T> extends BBuffer<T> {
    private final int size;
    private final int offset;
    private final BBuffer<T> parent;

    public BSubBuffer(BBuffer<T> parent, int size, int offset) {
	this.size = size;
	this.offset = offset;
	this.parent = parent;
    }

    @Override
    public int size() {
	return size;
    }

    @Override
    public T s(int index) {
	return parent.s(offset + index);
    }

    @Override
    public void s(int index, T v) {
	parent.s(offset + index, v);
    }

    @Override
    public Class<?> primType() {
	return parent.primType();
    }
    
}
